﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ISSGroup5ModelPresenter.View;
using ISSGroup5ModelPresenter.Model;

namespace ISSGroup5ModelPresenter.Presenter
{
    public class LoginPresenter
    {
        ILoginView _view;

        public LoginPresenter(ILoginView view)
        {
            _view = view;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        public void Login(string username, string password)
        {
            Console.WriteLine("login with username = {0} password = {1}", username, password);
            if (username == "admin")
            {
                ApplicationController.NavigateTo(EViewType.AdminView);
            }
            else if (username == "user")
            {
                ApplicationController.NavigateTo(EViewType.UserView);
            }
            else
            {
                _view.LoginFail();
            }
        }
        public void Exit()
        {
            _view.ExitView();            
        }
    }
}
